import requests

import common.assert_emp
from api.login_api import ihrmLogin
from common import assert_emp


class emp_insert:

    @classmethod
    def ihrm_emp_insert(self,name,mobile,num):
        data = ihrmLogin.ihrm_login('13800000002', '123456').json()['data']
        herderData = {"Content-Type":"application/json","Authorization":data}
        jsonData = {"username":name,"mobile":mobile,"workNumber":num}
        resp1 = requests.post(url='http://ihrm2-test.itheima.net/api/sys/user',
                             headers=herderData,
                             json=jsonData)
        return resp1

if __name__ == '__main__':
    resp = emp_insert().ihrm_emp_insert('张大大33','13343857432','12343554')
    print(resp.json())
    common.assert_emp.common_assert_emp(200,False,20002,'失败',resp)